gtk-demo: Rename the transition shader files
authorMatthias Clasen <mclasen@redhat.com>
Sat, 3 Oct 2020 04:01:25 +0000 (00:01 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 3 Oct 2020 04:01:25 +0000 (00:01 -0400)
Easier to find them when their name matches the title
that we show in the UI.

demos/gtk-demo/crosswarp.glsl [new file with mode: 0644]
demos/gtk-demo/demo.gresource.xml
demos/gtk-demo/gltransition.c
demos/gtk-demo/kaleidoscope.glsl [new file with mode: 0644]
demos/gtk-demo/radial.glsl [new file with mode: 0644]
demos/gtk-demo/transition1.glsl [deleted file]
demos/gtk-demo/transition2.glsl [deleted file]
demos/gtk-demo/transition3.glsl [deleted file]
demos/gtk-demo/transition4.glsl [deleted file]
demos/gtk-demo/wind.glsl [new file with mode: 0644]

diff --git a/demos/gtk-demo/crosswarp.glsl b/demos/gtk-demo/crosswarp.glsl
new file mode 100644 (file)
index 0000000..e1cc5f9
--- /dev/null
@@ -0,0 +1,27 @@
+uniform float progress;
+uniform sampler2D u_texture1;
+uniform sampler2D u_texture2;
+
+vec4 getFromColor (vec2 uv) {
+  return GskTexture(u_texture1, uv);
+}
+
+vec4 getToColor (vec2 uv) {
+  return GskTexture(u_texture2, uv);
+}
+
+// Source: https://gl-transitions.com/editor/crosswarp
+// Author: Eke Péter <peterekepeter@gmail.com>
+// License: MIT
+
+vec4 transition(vec2 p) {
+  float x = progress;
+  x=smoothstep(.0,1.0,(x*2.0+p.x-1.0));
+  return mix(getFromColor((p-.5)*(1.-x)+.5), getToColor((p-.5)*x+.5), x);
+}
+
+
+void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
+{
+  fragColor = transition(uv);
+}
index 224b4736e24a8dfb9329d03f735bfda6bc48e8b0..5dea806cd28f5e14e020536cdc2e1ecb3451341a 100644 (file)
     <file>gtkshaderbin.c</file>
     <file>gskshaderpaintable.h</file>
     <file>gskshaderpaintable.c</file>
+    <file>wind.glsl</file>
+    <file>radial.glsl</file>
+    <file>crosswarp.glsl</file>
+    <file>kaleidoscope.glsl</file>
+    <file>cogs2.glsl</file>
     <file>ripple.glsl</file>
     <file>background.glsl</file>
-   <file>transition1.glsl</file>
-    <file>transition2.glsl</file>
-    <file>transition3.glsl</file>
-    <file>transition4.glsl</file>
-    <file>cogs2.glsl</file>
   </gresource>
   <gresource prefix="/iconscroll">
     <file>iconscroll.ui</file>
index b95ffc4d6d19b48eb0e8d4409e651b79002a4610..96ccf9acac27295c42709ab5b3efa413767a68f8 100644 (file)
@@ -320,16 +320,16 @@ create_gltransition_window (GtkWidget *do_widget)
   gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
 
   gtk_grid_attach (GTK_GRID (grid),
-                   make_shader_stack ("Wind", "/gltransition/transition1.glsl", 0, scale),
+                   make_shader_stack ("Wind", "/gltransition/wind.glsl", 0, scale),
                    0, 0, 1, 1);
   gtk_grid_attach (GTK_GRID (grid),
-                   make_shader_stack ("Radial", "/gltransition/transition2.glsl", 1, scale),
+                   make_shader_stack ("Radial", "/gltransition/radial.glsl", 1, scale),
                    1, 0, 1, 1);
   gtk_grid_attach (GTK_GRID (grid),
-                   make_shader_stack ("Crosswarp", "/gltransition/transition3.glsl", 2, scale),
+                   make_shader_stack ("Crosswarp", "/gltransition/crosswarp.glsl", 2, scale),
                    0, 1, 1, 1);
   gtk_grid_attach (GTK_GRID (grid),
-                   make_shader_stack ("Kaleidoscope", "/gltransition/transition4.glsl", 3, scale),
+                   make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
                    1, 1, 1, 1);
 
   return window;
diff --git a/demos/gtk-demo/kaleidoscope.glsl b/demos/gtk-demo/kaleidoscope.glsl
new file mode 100644 (file)
index 0000000..d516b3d
--- /dev/null
@@ -0,0 +1,41 @@
+uniform float progress;
+uniform sampler2D u_texture1;
+uniform sampler2D u_texture2;
+
+vec4 getFromColor (vec2 uv) {
+  return GskTexture(u_texture1, uv);
+}
+
+vec4 getToColor (vec2 uv) {
+  return GskTexture(u_texture2, uv);
+}
+
+// Source: https://gl-transitions.com/editor/kaleidoscope
+// Author: nwoeanhinnogaehr
+// License: MIT
+
+const float speed = 1.0;
+const float angle = 1.0;
+const float power = 1.5;
+
+vec4 transition(vec2 uv) {
+  vec2 p = uv.xy / vec2(1.0).xy;
+  vec2 q = p;
+  float t = pow(progress, power)*speed;
+  p = p -0.5;
+  for (int i = 0; i < 7; i++) {
+    p = vec2(sin(t)*p.x + cos(t)*p.y, sin(t)*p.y - cos(t)*p.x);
+    t += angle;
+    p = abs(mod(p, 2.0) - 1.0);
+  }
+  abs(mod(p, 1.0));
+  return mix(
+    mix(getFromColor(q), getToColor(q), progress),
+    mix(getFromColor(p), getToColor(p), progress), 1.0 - 2.0*abs(progress - 0.5));
+}
+
+
+void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
+{
+  fragColor = transition(uv);
+}
diff --git a/demos/gtk-demo/radial.glsl b/demos/gtk-demo/radial.glsl
new file mode 100644 (file)
index 0000000..11757f4
--- /dev/null
@@ -0,0 +1,34 @@
+uniform float progress;
+uniform sampler2D u_texture1;
+uniform sampler2D u_texture2;
+
+vec4 getFromColor (vec2 uv) {
+  return GskTexture(u_texture1, uv);
+}
+
+vec4 getToColor (vec2 uv) {
+  return GskTexture(u_texture2, uv);
+}
+
+// Source: https://gl-transitions.com/editor/Radial
+// License: MIT
+// Author: Xaychru
+
+const float smoothness = 1.0;
+
+const float PI = 3.141592653589;
+
+vec4 transition(vec2 p) {
+  vec2 rp = p*2.-1.;
+  return mix(
+    getToColor(p),
+    getFromColor(p),
+    smoothstep(0., smoothness, atan(rp.y,rp.x) - (progress-.5) * PI * 2.5)
+  );
+}
+
+
+void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
+{
+  fragColor = transition(uv);
+}
diff --git a/demos/gtk-demo/transition1.glsl b/demos/gtk-demo/transition1.glsl
deleted file mode 100644 (file)
index 169bdcb..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-uniform float progress;
-uniform sampler2D u_texture1;
-uniform sampler2D u_texture2;
-
-vec4 getFromColor (vec2 uv) {
-  return GskTexture(u_texture1, uv);
-}
-
-vec4 getToColor (vec2 uv) {
-  return GskTexture(u_texture2, uv);
-}
-
-// Source: https://gl-transitions.com/editor/wind
-// Author: gre
-// License: MIT
-
-const float size = 0.2;
-
-float rand(vec2 co) {
-  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
-}
-
-vec4 transition(vec2 p) {
-  float r = rand(vec2(0, p.y));
-  float m = smoothstep(0.0, -size, p.x*(1.0-size) + size*r - (progress * (1.0 + size)));
-  return mix(getFromColor(p), getToColor(p), m);
-}
-
-
-void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
-{
-  fragColor = transition(uv);
-}
diff --git a/demos/gtk-demo/transition2.glsl b/demos/gtk-demo/transition2.glsl
deleted file mode 100644 (file)
index 11757f4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-uniform float progress;
-uniform sampler2D u_texture1;
-uniform sampler2D u_texture2;
-
-vec4 getFromColor (vec2 uv) {
-  return GskTexture(u_texture1, uv);
-}
-
-vec4 getToColor (vec2 uv) {
-  return GskTexture(u_texture2, uv);
-}
-
-// Source: https://gl-transitions.com/editor/Radial
-// License: MIT
-// Author: Xaychru
-
-const float smoothness = 1.0;
-
-const float PI = 3.141592653589;
-
-vec4 transition(vec2 p) {
-  vec2 rp = p*2.-1.;
-  return mix(
-    getToColor(p),
-    getFromColor(p),
-    smoothstep(0., smoothness, atan(rp.y,rp.x) - (progress-.5) * PI * 2.5)
-  );
-}
-
-
-void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
-{
-  fragColor = transition(uv);
-}
diff --git a/demos/gtk-demo/transition3.glsl b/demos/gtk-demo/transition3.glsl
deleted file mode 100644 (file)
index e1cc5f9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-uniform float progress;
-uniform sampler2D u_texture1;
-uniform sampler2D u_texture2;
-
-vec4 getFromColor (vec2 uv) {
-  return GskTexture(u_texture1, uv);
-}
-
-vec4 getToColor (vec2 uv) {
-  return GskTexture(u_texture2, uv);
-}
-
-// Source: https://gl-transitions.com/editor/crosswarp
-// Author: Eke Péter <peterekepeter@gmail.com>
-// License: MIT
-
-vec4 transition(vec2 p) {
-  float x = progress;
-  x=smoothstep(.0,1.0,(x*2.0+p.x-1.0));
-  return mix(getFromColor((p-.5)*(1.-x)+.5), getToColor((p-.5)*x+.5), x);
-}
-
-
-void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
-{
-  fragColor = transition(uv);
-}
diff --git a/demos/gtk-demo/transition4.glsl b/demos/gtk-demo/transition4.glsl
deleted file mode 100644 (file)
index d516b3d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-uniform float progress;
-uniform sampler2D u_texture1;
-uniform sampler2D u_texture2;
-
-vec4 getFromColor (vec2 uv) {
-  return GskTexture(u_texture1, uv);
-}
-
-vec4 getToColor (vec2 uv) {
-  return GskTexture(u_texture2, uv);
-}
-
-// Source: https://gl-transitions.com/editor/kaleidoscope
-// Author: nwoeanhinnogaehr
-// License: MIT
-
-const float speed = 1.0;
-const float angle = 1.0;
-const float power = 1.5;
-
-vec4 transition(vec2 uv) {
-  vec2 p = uv.xy / vec2(1.0).xy;
-  vec2 q = p;
-  float t = pow(progress, power)*speed;
-  p = p -0.5;
-  for (int i = 0; i < 7; i++) {
-    p = vec2(sin(t)*p.x + cos(t)*p.y, sin(t)*p.y - cos(t)*p.x);
-    t += angle;
-    p = abs(mod(p, 2.0) - 1.0);
-  }
-  abs(mod(p, 1.0));
-  return mix(
-    mix(getFromColor(q), getToColor(q), progress),
-    mix(getFromColor(p), getToColor(p), progress), 1.0 - 2.0*abs(progress - 0.5));
-}
-
-
-void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
-{
-  fragColor = transition(uv);
-}
diff --git a/demos/gtk-demo/wind.glsl b/demos/gtk-demo/wind.glsl
new file mode 100644 (file)
index 0000000..169bdcb
--- /dev/null
@@ -0,0 +1,33 @@
+uniform float progress;
+uniform sampler2D u_texture1;
+uniform sampler2D u_texture2;
+
+vec4 getFromColor (vec2 uv) {
+  return GskTexture(u_texture1, uv);
+}
+
+vec4 getToColor (vec2 uv) {
+  return GskTexture(u_texture2, uv);
+}
+
+// Source: https://gl-transitions.com/editor/wind
+// Author: gre
+// License: MIT
+
+const float size = 0.2;
+
+float rand(vec2 co) {
+  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
+}
+
+vec4 transition(vec2 p) {
+  float r = rand(vec2(0, p.y));
+  float m = smoothstep(0.0, -size, p.x*(1.0-size) + size*r - (progress * (1.0 + size)));
+  return mix(getFromColor(p), getToColor(p), m);
+}
+
+
+void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
+{
+  fragColor = transition(uv);
+}